import request from '@/utils/request'

// 获取文章类别
export const getArticleClass = () => {
  return request.get('/my/cate/list')
}

// 增加文章分类
export const addArticleCateAPI = ({ cate_name, cate_alias }) => {
  return request.post('/my/cate/add', {
    cate_name,
    cate_alias
  })
}
// 获取文章分类详情
export const getArticleDetailAPI = (id) => {
  return request.get('/my/cate/info', {
    params: {
      id
    }
  })
}
// 编辑文章分类
export const updateArticleCateAPI = ({ id, cate_name, cate_alias }) => {
  return request.put('/my/cate/info', {
    id,
    cate_name,
    cate_alias
  })
}
// 删除文章分类
export const delArticleCateAPI = (id) => {
  return request.delete('/my/cate/del', {
    params: {
      id
    }
  })
}

// 获取文章列表
export const getArticleListAPI = (params) => {
  return request.get('/my/article/list', {
    params
  })
}

// 发布文章
export const publishArticleAPI = (data) => {
  return request.post('/my/article/add', data)
}

// 获取文章详情
export const getArticleAPI = (id) => {
  return request.get('/my/article/info', {
    params: {
      id
    }
  })
}
// 删除文章
export const delArticleAPI = (id) => {
  return request.delete('/my/article/info', {
    params: {
      id
    }
  })
}
